class Solution {
public:
    vector<int> singleNumber(vector<int>& nums) {
        int num = 0;
        for (int e : nums)
        {
            num ^= e;
        }
        int tmp;
        for (int i = 0; i < 32; i++)
        {
            if (num & (1 << i))
            {
                tmp = 1 << i;
            }
        }
        int a = 0;
        int b = 0;
        for (int e : nums)
        {
            if (e & tmp)
            {
                a ^= e;
            }
            else
            {
                b ^= e;
            }
        }
        vector<int> v{ a,b };
        return v;
    }
};